import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yi_shop/components/refund/info.dart';
import 'package:yi_shop/ui/keep_alive.dart';
import 'package:yi_shop/utils/styles.dart';
import 'package:yi_shop/utils/tools.dart';

class SaleRefundInfoController extends GetxController {
  RxInt status = 1.obs;

  @override
  void onInit() {
    if (Get.arguments != null) {
      var map = Get.arguments;
      status.value = map['status'] as int;
    }
    super.onInit();
  }
}

class SaleRefundInfoPage extends GetView<SaleRefundInfoController> {
  const SaleRefundInfoPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        leading: ToolsUtils.builderLeading(),
        title: Text(
          '退款详情',
          style: StylesUtils.customTextStyle(
              fontWeight: FontWeight.w700, fontSize: StylesUtils.fontSize18),
        ),
      ),
      body: Obx(() {
        switch (controller.status.value) {
          case 1:
            return KeepAliveWrapperTabView(
              child: const RefundInfoApplyView(),
              callback: () {
                Get.put(RefundInfoApplyController());
              },
            );
          case 2:
            return KeepAliveWrapperTabView(
              child: const RefundInfoAgreeView(),
              callback: () {
                Get.put(RefundInfoAgreeController());
              },
            );
          default:
            return KeepAliveWrapperTabView(
              child: const RefundInfoSucceedView(),
              callback: () {
                Get.put(RefundInfoSucceedController());
              },
            );
        }
      }),
    );
  }
}
